package com.drojian.demo2.cartoon;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

import com.drojian.demo.R;

public class FrameCartoonActivity extends AppCompatActivity {
    private AnimationDrawable background;
    boolean flag = true;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.patr2_activity_frame_cartoon);
        ImageView frame = findViewById(R.id.frame_image);
        background = (AnimationDrawable)frame.getBackground();
    }

    public void onclick1(View view) {
            if(flag){
                background.start();
                flag = false;
            }else {
                background.stop();
                flag = true;
            }
    }

}